/**
    @project {
        "templateId": "org.helgoboss.custom",
        "version": "0.1-SNAPSHOT",
        "dependencies": [
            "org.scala-lang:scala-library:2.9.0-1",
            "org.helgoboss:quick-launcher:0.1-SNAPSHOT",
            "org.helgoboss:scala-additions:0.1-SNAPSHOT",
            "org.helgoboss:osgi-additions:0.1-SNAPSHOT",
            "org.helgoboss:commandlet-api:0.1-SNAPSHOT",
            "org.helgoboss:commandlet-convenience:0.1-SNAPSHOT"
        ]
    }
*/

package org.helgoboss.quick_launcher_commandlet

import org.helgoboss.commandlet._
import org.helgoboss.osgi_additions._
import org.helgoboss.osgi_additions.metatype._
import org.helgoboss.quick_launcher.QuickLauncher

class Activator extends OsgiProvider with OsgiServiceWatcher {
    whenBundleActive {
        whenServicePresent[QuickLauncher] {
            new QuickLauncherCommandlet(_).providesService[Commandlet]
        }
    }
}


class QuickLauncherCommandlet(quickLauncher: QuickLauncher) extends Commandlet {
    val id = "org.helgoboss.quick-launcher"

    def execute(context: ExecutionContext) = quickLauncher.open(context)
}